class Report {
 
  Person student
  Project project 
  byte[] associatedFile
  String fileName
  String contentType
  Date submitDate

  static belongsTo = [student:Person, project:Project]

  static constraints = {
    student(nullable:false)
    project(nullable:false)
    associatedFile(maxSize:20971520)
    fileName(nullable:true)
    contentType(nullable:true)
    submitDate()
  }

  String toString(){
    return fileName
  }

	static mapping = {
		columns {
			project column: 'project'
			person column: 'person'
		}
	}

	def getComments() {
		return Comment.findAll("from Comment as c where c.report=" + this.id)
	}

/*   
  static mapping = {
      columns {
          associatedFile type:'blob'
      }
   }  
*/
} 
